require('../css/base.css');
require('../less/base.less');
require('../css/login.less');
require('../css/iconfont.css');
require('../css/jeui/skin/jebox.css');
$(function() {
    $("html").css("background", "#333");
    $("body").css("background", "#333");
    $('#btn-login').click(function() {
        if ($('#username-input').val() == '') {
            jeBox.msg("请输入用户名!", { icon: 3, time: 3 });
            return false;
        } else if ($('#password-input').val() == '') {
            jeBox.msg("请输入密码!", { icon: 3, time: 3 });
            return false;
        } else {
            var login_json_data = { "id": "1", "jsonrpc": "2.0", "method": "login", "params": { "user": { "userName": $('#username-input').val(), "password": $('#password-input').val() } } };
            var login_data = $.ajax({
                type: "post",
                contentType: "application/json;charset=utf-8",
                url: "/api/baseInfoApi",
                dataType: "json",
                data: JSON.stringify(login_json_data),
            })
            login_data.then(function(res) {
                if (res.result.code == "200") {
                    window.location.href = "index.html"
                    console.log(res.result)
                } else {
                    // alert_msg("用户名或密码错误,请重新输入!");
                    jeBox.msg("用户名或密码错误,请重新输入!", { icon: 3, time: 3 });

                }
            })

        }
    })
});